<template>
  <div class="menu-wrapper">
    <template v-for="(item,index) in menu">
      <el-menu-item v-if="!item.children||!item.children.length" v-show='!item.meta.hideFlag' :index="item.path"
                    @click="open(item)" :key="item.path">
        <i :class="item.meta.icon"></i>
        <span slot="title">{{item.meta.name}}</span>
      </el-menu-item>
      <el-submenu v-else v-show='!item.meta.hideFlag' :index="item.path" :key="item.path">
        <template slot="title">
          <i :class="item.meta.icon"></i>
          <span slot="title">{{item.meta.name}}</span>
        </template>
        <nav-item :menu="item.children||[]"></nav-item>
      </el-submenu>
    </template>
  </div>
</template>
<script>
  export default {
    name: "navItem",
    data() {
      return {};
    },
    props: {
      menu: {
        type: Array
      },
      isCollapse: {
        type: Boolean
      }
    },
    created() {

    },
    mounted() {
    },
    computed: {},
    methods: {
      open(item) {
        this.routeTo(item);
      }
    }
  };
</script>
<style>
  .el-menu--collapse span {
    display: none;
  }

  .el-menu--collapse .el-submenu__icon-arrow {
    display: none;
  }

  .el-menu--collapse .el-submenu__title,
  .el-menu--collapse .el-menu-item,
  .el-menu--collapse .el-tooltip {
    padding: 0 5px !important;
  }
</style>
